const { User } = require('../db')
const { encryptPassword } = require('../util/security')

async function updatePassword (ctx) {
  await User.updateOne({
    _id: ctx.tl._id
  }, {
    password: encryptPassword(ctx.request.body.password)
  })
  ctx.body = 'success'
}

module.exports = {
  updatePassword
}
